<template>
    <el-container style="height:100%;">
        <el-header>
            <el-row class="row1">
                <el-col :span="9">
                    <img src="../../assets/logo.jpg" alt="" style="padding-left: 60px;padding-top: 15px;width:100px;height:30px;">
                </el-col>
                <el-col :span="11">
                    <el-menu
                    router
                        :default-active="$route.path"
                        class="el-menu-demo"
                        mode="horizontal"
                        background-color="#3A3A3A"
                        text-color="#fff"
                        active-text-color="#ffd04b">
                        <el-menu-item index="/shouye">主页</el-menu-item>
                        <el-menu-item index="/server">服务</el-menu-item>
                        <el-menu-item index="/suggest">给予建议</el-menu-item>
                        <!-- <el-menu-item index="4">酒店图片</el-menu-item> -->
                        <el-menu-item index="/hotalreserve">酒店预定</el-menu-item>
                        <el-menu-item index="/customerservice">联系我们</el-menu-item>
                        <el-menu-item index="/userLogin">用户登录</el-menu-item>
                        <el-menu-item index="/userregister">用户注册</el-menu-item>
                    </el-menu>
                </el-col>
                <el-col :span="4" style="text-align: center;padding-top:12px;">
                    <font size=4 color = "#B289A3;" style="padding-right: 52px;">{{num == 1 ? user.uname : '欢迎 :' + user.uname}} </font>
                    <el-button type="warning" style="padding:10px;" size= "mini" @click="tuichu">退出</el-button>
                </el-col>
            </el-row>
        </el-header>
        <el-main style="padding:0px;">
            
            <router-view></router-view>
        </el-main>
    </el-container>
    
</template>

<script>
import {findOneUserByuid} from '../../api'
export default {
    data() {
        return {
            user : {},
            num : 0
        }
    },
    
    created() {
        this.panduan()
    },
    methods: {
        async panduan(){
            let userid = sessionStorage.getItem('userid')
            if(userid != null){
                let {data:baseRefault} = await findOneUserByuid(userid)
                this.user = baseRefault.data
            }else{
                var str = '亲，请登录'
                this.user.uname = str
                this.num = 1
            }
        },
        tuichu(){
            sessionStorage.removeItem('userid')
            this.$message.success('退出成功')
            this.$router.go(0)
        }
    },
}
</script>

<style>
.row1{
    background-color: #3A3A3A;
}
.el-header{
    background-color: #3A3A3A;
  }
  .el-main {
    background-color: #E9EEF3;
    color: #333;
    
  }
</style>